import { validate } from './validate'

export function version(uuid: string): number {
  if (!validate(uuid))  throw TypeError('Invalid UUID')
  return parseInt(uuid.slice(14, 15), 16)
}
